# Include the directory itself as a path to include directories
set( CMAKE_INCLUDE_CURRENT_DIR ON )

# Add requirements for external libraries
find_package( Lua51 REQUIRED )
include_directories( ${LUA_INCLUDE_DIR} )

# Create a variable containing all .cpp files
file( GLOB core_SOURCES *.cpp )

# Create a variable containing all .h files
file( GLOB core_HEADERS *.h )

# Generate rules to copy over lua files as needed
file( GLOB core_LUA_SRCS *.lua )
copy_if_different( 
	"" "${EXECUTABLE_OUTPUT_PATH}/core"
	"${core_LUA_SRCS}" core_LUA_TGTS "Core Lua" 
)

# Create a library for this module
add_library( core ${core_SOURCES} ${core_HEADERS} ${core_LUA_TGTS} )

# Set up other dependencies
target_link_libraries( core ${CMAKE_DL_LIBS} )
target_link_libraries( core ${LUA_LIBRARIES} )

# Set up installation targets
install( FILES ${core_LUA_TGTS} DESTINATION bin/core )
